<?php
error_reporting(0);
$uid = empty($_GET['uid']) ? 0 : intval($_GET['uid']);
$type = $_GET['type']=='big' ? 'big' : 'small';
$random = empty($_GET['random']) ? '' : '?r='.time();

$userpic = "uploadfile/userpic/{$type}/{$uid}.jpg";
if(file_exists(dirname(__FILE__).'/'.$userpic)) {
	$userpic_url = $userpic.$random;
} else {
	$userpic_url = "images/img_userpic_{$type}.jpg";
}

if(empty($random)) {
	header("HTTP/1.1 301 Moved Permanently");
	header("Last-Modified:".date('r'));
	header("Expires: ".date('r', time() + 86400));
}
header("location:{$userpic_url}");
exit;
?>